<template>
    <div id="putRecord">
        <el-popover placement="bottom-start" width="1018" style="box-shadow: 0 0 8px rgba(0,0,0,.5);" trigger="click">
            <el-form :inline="true" label-width="90px" :model="searchList" class="demo-ruleForm">
                <el-form-item label="卡号" style="margin-bottom: 5px;">
                    <el-input v-model="searchList.cardId"  style="width: 100px;"></el-input></el-form-item>
                <el-form-item label="姓名" style="margin-bottom: 5px;"><el-input v-model="searchList.providerName"  style="width: 100px;"></el-input></el-form-item>
                <el-form-item label="电话" style="margin-bottom: 5px;">
                    <el-input v-model="searchList.phone"  style="width: 100px;"></el-input>
                </el-form-item>
                <el-form-item label="性别" style="margin-bottom: 5px;">
                    <el-select v-model="searchList.sex"  style="width: 100px;">
                        <el-option value="" label="【空】"></el-option>
                        <el-option :value="1" label="男"></el-option>
                        <el-option :value="2" label="女"></el-option>
                        </el-select>
                </el-form-item>
                <el-form-item label="血型" style="margin-bottom: 5px;"><el-select v-model="searchList.bloodType"  style="width: 100px;"><el-option value="" label="【空】"></el-option><el-option v-for="item in codeData12" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                <el-form-item label="介绍人" style="margin-bottom: 0;"><el-input v-model="searchList.jsr"  style="width: 100px;"></el-input></el-form-item>
                <el-form-item label="浆员状态" style="margin-bottom: 0;"><el-select v-model="searchList.providerState"  style="width: 100px;"><el-option value="" label="【空】"></el-option><el-option v-for="item in codeData14" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                <el-form-item label="创建时间" style="margin: 5px 10px 5px 0;"><el-date-picker v-model="searchList.time"  type="daterange" style="width: 305px;" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" align="right"></el-date-picker></el-form-item>
            </el-form>
            <el-form :inline="true" label-width="90px" :model="searchList" class="demo-ruleForm">
                <el-form-item label="身份证"><el-input v-model="searchList.idNo"  style="width: 170px;"></el-input></el-form-item>
                <el-form-item label="身份证地址"><el-input v-model="searchList.idNoAddress"  style="width: 170px;"></el-input></el-form-item>
                <el-form-item label="地址" style="margin-left: -5px;"><el-input v-model="searchList.address"  style="width: 170px;"></el-input></el-form-item>
                <el-button type="primary" @click="submitSearchData" style="margin: 0 0 0 50px;padding: 7px 15px;">提交</el-button>
            </el-form>
            <el-button slot="reference" type="primary">查询</el-button>
        </el-popover>
        <el-button type="primary" @click="inserteDialog">添加</el-button>
        <!-- 表格 -->
        <el-table :data="tableData" stripe border class="company-table" :height="tableHeight" style="width: 100%;" :header-cell-style="getRowClass">
            <el-table-column fixed type="index" label="*" sortable align="center" min-width="40"></el-table-column>
            <el-table-column prop="icon" label="头像" sortable min-width="75"><template slot-scope="scope">
                <img :src="scope.row.photo" style="width: 25px;height:30px"></template>
            </el-table-column>
            <el-table-column prop="cardId" label="卡号" sortable min-width="80"></el-table-column>
            <el-table-column prop="name" label="姓名" sortable min-width="80"></el-table-column>
            <el-table-column prop="sex" label="性别" :formatter="formatSex" sortable min-width="75"></el-table-column>
            <el-table-column prop="age" label="年龄" sortable min-width="75"></el-table-column>
            <el-table-column prop="idNo" label="身份证号" sortable min-width="180"></el-table-column>
            <el-table-column prop="createDate" label="创建日期" sortable min-width="170"></el-table-column>
            <el-table-column prop="createNurseName" label="创建护士" sortable min-width="110"></el-table-column>
            <el-table-column prop="phone" label="电话" sortable min-width="120"></el-table-column>
            <el-table-column prop="idNoAddress" label="地址" sortable min-width="350"></el-table-column>
            <el-table-column prop="introducer" label="介绍人" sortable min-width="100"></el-table-column>
            <el-table-column fixed="right" label="操作" sortable align="center" min-width="75">
                <template slot-scope="scope">
                    <el-button  @click="updateDialog(scope.row)" type="text" size="small">编辑</el-button>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="searchList.currentPage" :page-sizes="[10, 15,20, 25,30,50, 100]" :page-size="searchList.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalData"></el-pagination>


        <!-- 详情 -->
        <el-dialog :title="dialogTitle" :visible.sync="isDialog" width="1000px" top="60px" :close-on-clcick-modal="false">
            <el-tabs v-model="activeName" @tab-click="handleClick" style="padding-bottom: 15px;">
                <el-tab-pane label="基础信息" name="1" :style="dialogHeight">
                    <h3 class="dialog-plate-title" style="margin: 5px 0 10px;"><span>基本信息</span></h3>
                    <el-row :gutter="20" style="margin-right: 0;">
                        <el-col :span="18">
                            <el-form :inline="true" :model="dialogList" ref="dialogRefs" :rules="dialogRules" label-width="120px" >
                                <el-form-item label="卡号" prop="cardId" v-if="dialogTitle!=='添加'" ><el-input v-model="dialogList.cardId" :disabled="dialogTitle!=='添加'"></el-input></el-form-item>
                                <el-form-item label="姓名" prop="name"><el-input v-model="dialogList.name" :disabled="dialogTitle!=='添加'"></el-input></el-form-item>
                                <el-form-item label="身份证号" prop="idNo"><el-input v-model="dialogList.idNo" :disabled="dialogTitle!=='添加'"></el-input></el-form-item>
                                <el-form-item label="出生日期" prop="birthday"><el-date-picker v-model="dialogList.birthday" :disabled="dialogTitle!=='添加'" type="date" placeholder="选择日期"></el-date-picker></el-form-item>
                                <el-form-item label="年龄" prop="age"><el-input v-model="dialogList.age" :disabled="dialogTitle!=='添加'"></el-input></el-form-item>
                                <el-form-item label="性别" prop="sex"><el-select v-model="dialogList.sex" :disabled="dialogTitle!=='添加'" class="select200"><el-option :value="1" label="男"></el-option><el-option :value="2" label="女"></el-option></el-select></el-form-item>
                                <el-form-item label="身份证地址"><el-input v-model="dialogList.idNoAddress" :disabled="dialogTitle!=='添加'"></el-input></el-form-item>
                                <el-form-item label="地址"><el-input v-model="dialogList.address"></el-input></el-form-item>
                                <el-form-item label="电话"><el-input v-model="dialogList.phone"></el-input></el-form-item>
                                <el-form-item label="文化水平"><el-select v-model="dialogList.educationalLevel" class="select200"><el-option v-for="item in codeData8" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                                <el-form-item label="婚姻状态"><el-select v-model="dialogList.maritalStatus" class="select200"><el-option v-for="item in codeData9" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                                <el-form-item label="浆员类型" v-if="dialogTitle!=='添加'"><el-select v-model="dialogList.jylxId" class="select200"><el-option v-for="item in codeData10" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                                <el-form-item label="血浆类型" v-if="dialogTitle!=='添加'"><el-select v-model="dialogList.plasmaType" disabled class="select200"><el-option v-for="item in codeData11" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                                <el-form-item label="血型" v-if="dialogTitle!=='添加'"><el-input v-model="dialogList.bloodTypeName" disabled></el-input></el-form-item>
                                <el-form-item label="血管等级" v-if="dialogTitle!=='添加'"><el-select v-model="dialogList.veinGrade" class="select200"><el-option v-for="item in codeData13" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                                <el-form-item label="浆员状态" v-if="dialogTitle!=='添加'"><el-select v-model="dialogList.providerState" disabled class="select200"><el-option v-for="item in codeData14" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                                <el-form-item v-if="dialogList.providerState!='0'" label="拒绝原因"><el-input v-model="dialogList.refuseReason" disabled></el-input></el-form-item>
                                <el-form-item v-if="dialogList.providerState!='0'" label="拒绝时间"><el-date-picker v-model="dialogList.refuseDate" disabled type="date" placeholder="选择日期"></el-date-picker></el-form-item>
                                <el-form-item label="创建日期"><el-input v-model="dialogList.createDate" disabled></el-input></el-form-item>
                                <el-form-item label="创建护士"><el-input v-model="dialogList.createNurseName" disabled></el-input></el-form-item>
                                <el-form-item label="介绍人" prop="introducer"><el-input v-model="dialogList.introducer"></el-input></el-form-item>
                                <el-form-item label="介绍人添加时间"><el-input v-model="dialogList.addIntroducerTime" disabled></el-input></el-form-item>
                            </el-form>
                        </el-col>
                        <el-col :span="6">
                            <div class="avatar-uploader"  style="height: 275px;">
                                <img v-if="dialogList.photo" :src="dialogList.photo" class="avatar" />
                            </div>
                        </el-col>
                    </el-row>

                    <h3 class="dialog-plate-title" style="margin: 15px 0 10px;"><span>身份证信息</span></h3>
                    <el-row :gutter="20" style="margin-right: 0;" >
                        <el-col :span="2">&nbsp;</el-col>
                        <el-col :span="9">
                            <el-upload class="avatar-uploader"
                                       style="height: 187px;"
                                       :action="idCardPhotoUrl"
                                       :show-file-list="false"
                                       :on-success="handleAvatarSuccess"
                                       :before-upload="beforeAvatarUpload"
                            >
                                <img v-if="dialogList.idCardPhoto" :src="dialogList.idCardPhoto" class="avatar" />
                                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                            </el-upload>
                        </el-col>
                        <el-col :span="2">&nbsp;</el-col>
                        <el-col :span="9">
                            <el-upload class="avatar-uploader"
                                       style="height: 187px;"
                                       :action="idCardPhotoUrl"
                                       :show-file-list="false"
                                       :on-success="handleAvatarSuccess1"
                                       :before-upload="beforeAvatarUpload"
                            >
                                <img v-if="dialogList.idCardPhoto1" :src="dialogList.idCardPhoto1" class="avatar" />
                                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                            </el-upload>
                        </el-col>
                        <el-col :span="2">&nbsp;</el-col>

                    </el-row>
                    <el-form :inline="true" :model="dialogList" label-width="100px" class="demo-ruleForm">
                        <el-form-item label="身份证有效期"><el-date-picker v-model="dialogList.idCardValidDate" type="date" placeholder="选择日期"></el-date-picker></el-form-item>
                        <el-form-item label="扫描时间"><el-input v-model="dialogList.idCardScanDate" disabled></el-input></el-form-item>
                        <el-form-item label="证照记录人"><el-input v-model="dialogList.certificateRegisterName" disabled style="width: 190px;"></el-input></el-form-item>
                    </el-form>

                    <!-- 提交 -->
                    <el-form>
                        <el-form-item>
                            <el-button  type="primary" @click="submitDialog">提交</el-button>
                        </el-form-item>
                    </el-form>

                    <h3 v-if="dialogTitle!=='添加'" class="dialog-plate-title" style="margin: 15px 0 10px;"><span>化检记录</span></h3>
                    <el-table v-if="dialogTitle!=='添加'" :data="chemicalInfoData" stripe border class="company-table" height="150px" style="width: 100%;" :header-cell-style="getRowClass">
                        <el-table-column fixed type="index" label="*" sortable align="center" min-width="40"></el-table-column>
                        <el-table-column prop="recodeEndTime" label="采样时间" sortable min-width="200"></el-table-column>
                        <el-table-column prop="inspectionRecodePersonName" label="化检记录人" sortable min-width="150"></el-table-column>
                        <el-table-column prop="inspectionResultName" label="化检结果" sortable min-width="150"></el-table-column>
                        <el-table-column fixed="right" label="操作" sortable align="center" min-width="75">
                            <template slot-scope="scope">
                                <el-button  @click="updateChemicalInfoDialog(scope.row)" type="text" size="small">查看</el-button>
                            </template>
                        </el-table-column>
                    </el-table>

                    <h3 v-if="dialogTitle!=='添加'" class="dialog-plate-title" style="margin: 15px 0 10px;"><span>指纹记录</span></h3>
                    <el-table v-if="dialogTitle!=='添加'" :data="fingerPrintData" stripe border class="company-table" height="200px" style="width: 100%;margin-bottom: 20px;" :header-cell-style="getRowClass">
                        <el-table-column fixed type="index" label="*" sortable align="center" min-width="40"></el-table-column>
                        <el-table-column prop="codeName" label="已录指纹" sortable min-width="200"></el-table-column>
                    </el-table>


                </el-tab-pane>
                <el-tab-pane v-if="dialogTitle!=='添加'" label="胸片信息" name="2" :style="dialogHeight">
                    <el-button type="primary" @click="inserteChestDialog">新增</el-button>
                    <el-table :data="tableChestData" stripe border class="company-table" :height="dialogHeight2Table" style="width: 100%;" :header-cell-style="getRowClass">
                        <el-table-column fixed type="index" label="*" sortable align="center" min-width="40"></el-table-column>
                        <el-table-column prop="createDate" label="上传时间" sortable min-width="200"></el-table-column>
                        <el-table-column prop="result" label="是否合格" :formatter="formatterIsTrain" sortable min-width="150"></el-table-column>
                        <el-table-column prop="validDate" label="有效日期" sortable min-width="200"></el-table-column>
                        <el-table-column fixed="right" label="操作" sortable align="center" min-width="75">
                            <template slot-scope="scope">
                                <el-button  @click="updateChestDialog(scope.row)" type="text" size="small">编辑</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-tab-pane>
            </el-tabs>
        </el-dialog>

        <!-- 化检信息-->
        <el-dialog title="化检详细信息" :visible.sync="isChemicalInfoDialog" width="720px" center :close-on-clcick-modal="false">
            <h3 class="dialog-plate-title" style="margin-top: 20px;"><span>化检项目</span></h3>
            <el-form :inline="true" :model="dialogChemicalInfoList" label-width="120px" class="demo-ruleForm">
                <el-form-item label="全血比重"><el-input v-model="dialogChemicalInfoList.wholeBloodLevelName" disabled></el-input></el-form-item>
                <el-form-item label="蛋白含量"><el-input v-model="dialogChemicalInfoList.proteinLevel" disabled></el-input></el-form-item>
                <el-form-item label="血清蛋白含量"><el-input v-model="dialogChemicalInfoList.serumProteinLevel" disabled></el-input></el-form-item>
                <el-form-item label="血红蛋白含量"><el-input v-model="dialogChemicalInfoList.hemoglobinLevelName" disabled></el-input></el-form-item>
                <el-form-item label="HBsAg"><el-input v-model="dialogChemicalInfoList.hbsAgName" disabled></el-input></el-form-item>
                <el-form-item label="抗-HCV"> <el-input v-model="dialogChemicalInfoList.hcvName" disabled></el-input></el-form-item>
                <el-form-item label="梅毒"><el-input v-model="dialogChemicalInfoList.syphilisName" disabled></el-input></el-form-item>
                <el-form-item label="抗-HIV"><el-input v-model="dialogChemicalInfoList.hivName" disabled></el-input></el-form-item>
                <el-form-item label="ALT"><el-input v-model="dialogChemicalInfoList.altName" disabled></el-input></el-form-item>
                <el-form-item label="血型"><el-input v-model="dialogChemicalInfoList.bloodTypeName" disabled></el-input></el-form-item>
                <el-form-item label="化检备注"><el-input v-model="dialogChemicalInfoList.inspectionRemark" disabled type="textarea" :rows="1" style="width: 534px;"></el-input></el-form-item>
            </el-form>

            <h3 class="dialog-plate-title" style="margin-top: 20px;"><span>化检详情</span></h3>
            <el-form :inline="true" :model="dialogChemicalInfoList" label-width="120px" class="demo-ruleForm">
                <el-form-item label="化检结果"><el-input v-model="dialogChemicalInfoList.inspectionResultName" disabled></el-input></el-form-item>
                <el-form-item label="化验开始时间"><el-input v-model="dialogChemicalInfoList.inspectionStartTime" disabled></el-input></el-form-item>
                <el-form-item label="化验结束时间"><el-input v-model="dialogChemicalInfoList.inspectionEndTime" disabled></el-input></el-form-item>
                <el-form-item label="记录处理时间"><el-input v-model="dialogChemicalInfoList.recodeEndTime" disabled></el-input></el-form-item>
                <el-form-item label="化检记录人"><el-input v-model="dialogChemicalInfoList.inspectionRecodePersonName" disabled></el-input></el-form-item>
                <el-form-item label="记录创建时间"><el-input v-model="dialogChemicalInfoList.recodeStartTime" disabled></el-input></el-form-item>
            </el-form>
            <div slot="footer"></div>
        </el-dialog>

        <!-- 胸片信息 -->
        <el-dialog :title="dialogChestTitle" :visible.sync="isChestDialog" width="680px" top="70px" :close-on-clcick-modal="false">
            <div :style="dialogChestHeight">
                <el-form :inline="true" :model="dialogChestList" label-width="100px" class="demo-ruleForm">
                    <el-form-item label="检查单位"><el-input v-model="dialogChestList.hospital"></el-input></el-form-item>
                    <el-form-item label="检查医生"><el-input v-model="dialogChestList.doctor"></el-input></el-form-item>
                    <el-form-item label="检查备注"><el-input v-model="dialogChestList.remark"></el-input></el-form-item>
                    <el-form-item label="有效日期"><el-date-picker type="date" v-model="dialogChestList.validDate" placeholder="选择日期"></el-date-picker></el-form-item>
                    <el-form-item label="是否合格"><el-select v-model="dialogChestList.result" style="width: 200px;"><el-option :value="1" label="是"></el-option><el-option :value="0" label="否"></el-option></el-select></el-form-item>
                    <el-form-item label="上传时间"><el-input v-model="dialogChestList.createDate" disabled></el-input></el-form-item>
                    <el-form-item label="胸片记录人"><el-input v-model="dialogChestList.crearorName" disabled></el-input></el-form-item>
                </el-form>
                <el-row :gutter="20" style="margin-right: 0;" >
                    <el-col :span="1">&nbsp;</el-col>
                    <el-col :span="23">
                        <el-upload class="avatar-uploader"
                                   :action="idCardPhotoUrl"
                                   :show-file-list="false"
                                   :on-success="handleAvatarChestSuccess"
                                   :before-upload="beforeAvatarUpload"
                        >
                            <img v-if="dialogChestList.photo" :src="dialogChestList.photo" class="avatar" />
                            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                        </el-upload>
                    </el-col>
                </el-row>
            </div>
            <div slot="footer" style="text-align: right;">
                <el-button type="primary" @click="submitChestDialog">提交</el-button>
            </div>

        </el-dialog>

    </div>
</template>

<script>
import regx from '@/regx/regx.js'
import api from '@/axios/api.js'
    export default {
        name: "newPulpFiling",
        data(){
            return {
                tokenId: sessionStorage.getItem("tokenId"),
                activeName:'1',
                tableHeight: document.documentElement.clientHeight - 160,
                tableData:[],
                searchList:{
                    currentPage:1,
                    pageSize:10,
                    cardId:null,
                    providerName:null,
                    idNo:null,
                    sex:null,
                    idNoAddress:null,
                    address:null,
                    phone:null,
                    bloodType:null,
                    createStartTime:null,
                    createEndTime:null,
                    providerState:null,
                    jsr:null,
                    time:'',
                },

                //详情
                isDialog:false,
                dialogTitle:'',
                totalData:0,
                idCardPhotoUrl:"/api/adscm/filesystem/abc",
                dialogList:{
                    activityMeasure: "",
                    addIntroducerTime: "",
                    address: "",
                    age: "",
                    assayResult: "",
                    baseShotTimes: "",
                    becomeVolunteerDate: "",
                    birthday: "",
                    birthday1: "",
                    bloodType: "",
                    bloodTypeName: "",
                    cardId: "",
                    certificateRegister: "",
                    certificateRegisterName: "",
                    createDate: "",
                    createFileEndTime: "",
                    createFileStartTime: "",
                    createNurse: "",
                    createNurseName: "",
                    dataSyn: "",
                    educationalLevel: "",
                    educationalLevelName: "",
                    email: "",
                    faceReco: "",
                    fingerPrint: "",
                    firstDate: "",
                    firstSmallNo: "",
                    firstSmallTimeId: "",
                    firstTimeId: "",
                    gjzClassId: "",
                    icon: "",
                    id: "",
                    idCardPhoto: "",
                    idCardPhoto1: "",
                    idCardScanDate: "",
                    idCardValidDate: "",
                    idNo: "",
                    idNoAddress: "",
                    introducer: "",
                    isFocusGZH: "",
                    isPhotoQualified: "",
                    isVolunteer: "",
                    issueCertificateDate: "",
                    issueCertificateIntroduction: "",
                    jgId: "",
                    jydzId: "",
                    jylxId: "",
                    jylxIdName: "",
                    lastDate: "",
                    lastShotDate: "",
                    lastSmallNo: "",
                    lastTimeId: "",
                    manCertifCheck: "",
                    maritalStatus: "",
                    maritalStatusName: "",
                    mylbId: "",
                    name: "",
                    nation: "",
                    personThreshold1: "",
                    personThreshold2: "",
                    phone: "",
                    photo: "",
                    plasmaType: "",
                    plasmaTypeName: "",
                    provideAge: "",
                    provideTotalNum: "",
                    provideTotalTimes: "",
                    providerState: "",
                    providerStateName: "",
                    qq: "",
                    refuseDate: "",
                    refuseReason: "",
                    refuseTimeId: "",
                    regId: "",
                    sex: "",
                    sexName: "",
                    sftg: "",
                    similarFaceCount: "",
                    timeId: "",
                    timebd: "",
                    totalNotValidate: "",
                    totalNotValidateNum: "",
                    totalOverdue: "",
                    totalOverdueNum: "",
                    unReg: "",
                    upShotTimes: "",
                    userGrade: "",
                    veinGrade: "",
                    veinGradeName: "",
                    zip: "",
                },
                dialogHeight: {
                    height: document.documentElement.clientHeight - 250+ 'px',
                    overflowY: 'auto',
                },
                dialogHeight2Table: document.documentElement.clientHeight - 325+ 'px',

                //指纹
                fingerPrintData:[],

                //化检信息
                chemicalInfoData:[],
                isChemicalInfoDialog:false,
                dialogChemicalInfoList:{
                    address: "",
                    age: "",
                    alt: "",
                    altName: "",
                    authMethod: "",
                    bloodType: "",
                    bloodTypeName: "",
                    cardId: "",
                    createNurse: "",
                    createNurseName: "",
                    gatheringPlace: "",
                    gatheringTime: "",
                    hbsAg: "",
                    hbsAgName: "",
                    hcv: "",
                    hcvName: "",
                    hemoglobinLevel: "",
                    hemoglobinLevelName: "",
                    hiv: "",
                    hivName: "",
                    idAddress: "",
                    idNo: "",
                    inspectionEndTime: "",
                    inspectionRecodePerson: "",
                    inspectionRecodePersonName: "",
                    inspectionRemark: "",
                    inspectionResult: "",
                    inspectionResultName: "",
                    inspectionStartTime: "",
                    inspectionStatus: "",
                    name: "",
                    phone: "",
                    proteinLevel: "",
                    proteinLevelName: "",
                    providerNo: "",
                    recodeEndTime: "",
                    recodeNo: "",
                    recodeStartTime: "",
                    recodeStatus: "",
                    recodeStatusName: "",
                    recodeTIme: "",
                    sampleNo: "",
                    samplePhoto: "",
                    sampleType: "",
                    serumProteinLevel: "",
                    sex: "",
                    syphilis: "",
                    syphilisName: "",
                    threshold: "",
                    wholeBloodLevel: "",
                    wholeBloodLevelName: "",
                    yms: "",
                    ymx: "",
                    zsykdz: "",
                },

                //胸片
                tableChestData:[],
                isChestDialog:false,
                dialogChestTitle:'',
                dialogChestList:{
                    crearor: '',
                    crearorName: '',
                    createDate: '',
                    doctor: '',
                    hospital: '',
                    id: '',
                    photo: '',
                    providerNo: '',
                    remark: '',
                    result: '',
                    validDate: '',
                },
                dialogChestHeight: {
                    height: document.documentElement.clientHeight - 250+ 'px',
                    overflowY: 'auto',
                },


                dialogRules: {
                    cardId: [
                        { required: true, message: '请输入浆员卡号', trigger: 'blur' },
                    ],
                    name: [
                        { required: true, message: '请输入浆员姓名', trigger: 'blur' },
                    ],
                    idNo:[
                        { validator:regx.checkedID, trigger: 'blur' }
                    ],
                    birthday:[
                        { required: true, message: '请选择出生日期', trigger: 'blur' },
                    ],
                    age:[
                        { required: true, message: '请输入年龄', trigger: 'blur' },
                    ],
                    sex:[
                        { required: true, message: '请填写性别', trigger: 'blur' },
                    ],
                    introducer:[
                        { required: true, message: '请填写介绍人', trigger: 'blur' },
                    ]
                },
            }
        },
        created() {
            this.searchList.currentPage= 1;
            this.searchList.pageSize= 10;
            this.getData(this.searchList);
            this.getCodeData(8);
            this.getCodeData(9);
            this.getCodeData(10);
            this.getCodeData(11);
            this.getCodeData(12);
            this.getCodeData(13);
            this.getCodeData(14);
            this.getCodeData(17);
            this.getCodeData(18);
            this.getCodeData(20);
            this.getCodeData(21);
        },
        methods:{
            getData(data) {
                let list = {
                    currentPage:data.currentPage,
                    pageSize:data.pageSize,
                    cardId:data.cardId,
                    providerName:data.providerName,
                    idNo:data.idNo,
                    sex:data.sex,
                    idNoAddress:data.idNoAddress,
                    address:data.address,
                    phone:data.phone,
                    bloodType:data.bloodType,
                    createStartTime:data.createStartTime,
                    createEndTime:data.createEndTime,
                    providerState:data.providerState,
                    jsr:data.jsr,
                };
                let _this = this;
                let loading = this.$loading({
                    target: document.querySelector(".wrapper > .content-box"),
                    lock: true,
                    text: '正在努力加载中...',
                    spinner: 'el-icon-loading',
                    background: 'rgba(0, 0, 0, 0.8)'
                });
                this.$http({
                    url: '/api/adscm/application/providerInfo/selectProviderInfo?tokenId='+_this.tokenId,
                    method: 'post',
                    headers: {'X-Requested-With': 'XMLHttpRequest'},
                    data:list
                }).then(function (res) {


                    if (res.data.statusCode == 200) {
                        _this.totalData = res.data.content.total;
                        _this.tableData = res.data.content.records;
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                    loading.close();
                }).catch(function (catchres) {


                    _this.$message.error("加载失败！请重新加载...");
                    loading.close();
                })
            },
            submitSearchData(){
                this.searchList.createStartTime= this.searchList.time ? this.timestampToTime(this.searchList.time[0]).substr(0,10) : "";
                this.searchList.createEndTime= this.searchList.time ? this.timestampToTime(this.searchList.time[1]).substr(0,10) : "";
                this.getData(this.searchList);
            },

            //身份证上传
            beforeAvatarUpload(file) {
                const isJPG = file.type.substr(0,5) === 'image';
                const isLt10M = file.size / 1024 / 1024 < 10;

                if (!isJPG) {
                    this.$message.error('只能上传图片!');
                }
                if (!isLt10M) {
                    this.$message.error('上传头像图片大小不能超过 10MB!');
                }
                return isJPG && isLt10M;
            },
            handleAvatarSuccess(res, file,fileList) {
                this.dialogList.idCardPhoto = res;
            },
            handleAvatarSuccess1(res, file,fileList) {

                this.dialogList.idCardPhoto1 = res;

            },

            // 基础信息编辑
            inserteDialog(){
                this.isDialog = true;
                this.dialogTitle = '添加';
                this.activeName = '1';
                this.dialogList = {
                    activityMeasure: "",
                    addIntroducerTime: "",
                    address: "",
                    age: "",
                    assayResult: "",
                    baseShotTimes: "",
                    becomeVolunteerDate: "",
                    birthday: "",
                    birthday1: "",
                    bloodType: "",
                    bloodTypeName: "",
                    cardId: "1",
                    certificateRegister: "",
                    certificateRegisterName: "",
                    createDate: "",
                    createFileEndTime: "",
                    createFileStartTime: "",
                    createNurse: "",
                    createNurseName: "",
                    dataSyn: "",
                    educationalLevel: "",
                    educationalLevelName: "",
                    email: "",
                    faceReco: "",
                    fingerPrint: "",
                    firstDate: "",
                    firstSmallNo: "",
                    firstSmallTimeId: "",
                    firstTimeId: "",
                    gjzClassId: "",
                    icon: "",
                    id: "",
                    idCardPhoto: "",
                    idCardPhoto1: "",
                    idCardScanDate: "",
                    idCardValidDate: "",
                    idNo: "",
                    idNoAddress: "",
                    introducer: "",
                    isFocusGZH: "",
                    isPhotoQualified: "",
                    isVolunteer: "",
                    issueCertificateDate: "",
                    issueCertificateIntroduction: "",
                    jgId: "",
                    jydzId: "",
                    jylxId: "",
                    jylxIdName: "",
                    lastDate: "",
                    lastShotDate: "",
                    lastSmallNo: "",
                    lastTimeId: "",
                    manCertifCheck: "",
                    maritalStatus: "",
                    maritalStatusName: "",
                    mylbId: "",
                    name: "",
                    nation: "",
                    personThreshold1: "",
                    personThreshold2: "",
                    phone: "",
                    photo: "",
                    plasmaType: "",
                    plasmaTypeName: "",
                    provideAge: "",
                    provideTotalNum: "",
                    provideTotalTimes: "",
                    providerState: "0",
                    providerStateName: "",
                    qq: "",
                    refuseDate: "",
                    refuseReason: "",
                    refuseTimeId: "",
                    regId: "",
                    sex: "",
                    sexName: "",
                    sftg: "",
                    similarFaceCount: "",
                    timeId: "",
                    timebd: "",
                    totalNotValidate: "",
                    totalNotValidateNum: "",
                    totalOverdue: "",
                    totalOverdueNum: "",
                    unReg: "",
                    upShotTimes: "",
                    userGrade: "",
                    veinGrade: "",
                    veinGradeName: "",
                    zip: "",
                }
            },
            updateDialog(row){


                this.isDialog = true;
                this.dialogTitle = '编辑';
                this.activeName='1';
                this.dialogList = row;
                this.dialogList.sex = parseInt(row.sex);
                this.dialogList.jylxId =row.jylxId+'';
                this.dialogList.veinGrade =row.veinGrade+'';
                this.getChemicalInfoData();
                this.getFingerPrintData();
            },
            submitDialog(){
                let _this = this,url;
                _this.dialogList.birthday=_this.timestampToTime( _this.dialogList.birthday);
                _this.dialogList.refuseDate=_this.timestampToTime( _this.dialogList.refuseDate);
                _this.dialogList.idCardValidDate=_this.timestampToTime( _this.dialogList.idCardValidDate);
                if ( _this.dialogTitle === '添加') {
                    url='/api/adscm/application/providerInfo/insertProviderInfo?tokenId='+ _this.tokenId;
                } else if ( _this.dialogTitle === '编辑') {
                    url='/api/adscm/application/providerInfo/updateProviderInfo?tokenId='+ _this.tokenId;
                }
                this.$refs.dialogRefs.validate((valid) => {
                    if (valid) {
                        _this.$http({
                            url: url,
                            method: 'post',
                            headers: {'X-Requested-With': 'XMLHttpRequest'},
                            data:_this.dialogList
                        }).then(function (res) {
                            if (res.data.statusCode == 200) {
                                _this.$refs.dialogRefs.resetFields();
                                _this.isDialog = false;
                                _this.getData(_this.searchList);
                            } else {
                                _this.$message.error(res.data.desc);
                            }
                        }).catch(function (catchres) {
                            _this.$message.error("加载失败！请重新加载...");
                        })
                    } else {
                        return false;
                    }
                });
            },

            //化检信息
            getChemicalInfoData(){
                let _this = this;
                this.$http({
                    url: '/api/adscm/application/plasmaSamples/selectPlasmaSampleByProviderNo/'+_this.dialogList.id+'?tokenId='+_this.tokenId,
                    method: 'post',
                    headers: {'X-Requested-With': 'XMLHttpRequest'},
                }).then(function (res) {


                    if (res.data.statusCode == 200) {
                        _this.chemicalInfoData = [res.data.content];
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                })
            },
            updateChemicalInfoDialog(row){
                this.isChemicalInfoDialog =true;
                this.dialogChemicalInfoList = row;
            },

            //指纹
            getFingerPrintData() {
                let _this = this;
                this.$http({
                    url: '/api/adscm/application/providerZw/selectByProviderNo/'+_this.dialogList.id+'?tokenId='+_this.tokenId,
                    method: 'post',
                    headers: {'X-Requested-With': 'XMLHttpRequest'}
                }).then(function (res) {
                    if (res.data.statusCode == 200) {
                        _this.fingerPrintData = res.data.content;
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                })
            },


            //胸片
            getChestData(){
                let _this = this;
                this.$http({
                    url: '/api/adscm/application/providerXp/selectByProviderNo/'+_this.dialogList.id+'?tokenId='+_this.tokenId,
                    method: 'post',
                    headers: {'X-Requested-With': 'XMLHttpRequest'},
                }).then(function (res) {
                    if (res.data.statusCode == 200) {
                        _this.tableChestData = res.data.content;
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                })
            },
            handleAvatarChestSuccess(res, file,fileList) {
                this.dialogChestList.photo = res;
            },
            inserteChestDialog(){
                this.isChestDialog = true;
                this.dialogChestTitle = '添加';
                this.dialogChestList = {
                    crearor: '',
                    crearorName: '',
                    createDate: '',
                    doctor: '',
                    hospital: '',
                    id: '',
                    photo: '',
                    providerNo: this.dialogList.id,
                    remark: '',
                    result: '',
                    validDate: '',
                }
            },
            updateChestDialog(row){
                this.isChestDialog = true;
                this.dialogChestTitle = '编辑';
                this.dialogChestList = row;
                this.dialogChestList.result = parseInt(row.result);
            },
            submitChestDialog(){
                let _this = this,url;

                if ( _this.dialogChestTitle === '添加') {
                    url='/api/adscm/application/providerXp/insert?tokenId='+ _this.tokenId;
                } else if ( _this.dialogChestTitle === '编辑') {
                    url='/api/adscm/application/providerXp/update?tokenId='+ _this.tokenId;
                }
                _this.dialogChestList.validDate=_this.timestampToTime( _this.dialogChestList.validDate);
                if (_this.dialogChestList.hospital !== '') {
                    if (_this.dialogChestList.doctor !== '') {
                        if (_this.dialogChestList.remark !== '') {
                            if (_this.dialogChestList.validDate !== '') {
                                if (_this.dialogChestList.result!== '') {
                                    if (_this.dialogChestList.photo !== '') {
                                        _this.$http({url: url, method: 'post', headers: {'X-Requested-With': 'XMLHttpRequest'}, data:_this.dialogChestList}).then(function (res) {
                                            if (res.data.statusCode == 200) {
                                                _this.isChestDialog = false;
                                                _this.getChestData();
                                            } else {_this.$message.error(res.data.desc);}
                                        }).catch(function (catchres) {_this.$message.error("加载失败！请重新加载...");})
                                    } else {_this.$message.error('胸片必须上传！');}
                                } else {_this.$message.error('请选择是否合格！');}
                            } else {_this.$message.error('请填写有效日期！');}
                        } else {_this.$message.error('请填写检查备注！');}
                    } else {_this.$message.error('请填写检查医生！');}
                } else {_this.$message.error('请填写检查单位！');}
            },


            handleClick(tab, event){
                if (tab.name === '2') {
                    this.getChestData();
                }
            },
            handleSizeChange: function (size) {
                this.searchList.pageSize = size;
                this.searchList.createStartTime= this.searchList.time ? this.timestampToTime(this.searchList.time[0]).substr(0,10) : "";
                this.searchList.createEndTime= this.searchList.time ? this.timestampToTime(this.searchList.time[1]).substr(0,10) : "";
                this.getData(this.searchList);
            },
            handleCurrentChange: function (currentPage) {
                this.searchList.currentPage = currentPage;
                this.searchList.createStartTime= this.searchList.time ? this.timestampToTime(this.searchList.time[0]).substr(0,10) : "";
                this.searchList.createEndTime= this.searchList.time ? this.timestampToTime(this.searchList.time[1]).substr(0,10) : "";
                this.getData(this.searchList);
            },
            timestampToTime (timestamp) {
                if (timestamp) {
                    let date = new Date(timestamp);
                    let Y = date.getFullYear() + '-';
                    let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
                    let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + " ";
                    let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ":";
                    let m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ":";
                    let s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
                    return timestamp ? Y + M + D + h + m + s : '';
                } else {
                    return '';
                }
            },
            autoIDInfo:function(){ //自动获取身份信息
                let self = this;
                let idNo =self.dialogList.idNo;
               if(!regx.regexString.regxID.test(idNo)){
                    self.dialogList.birthday = "";
                    self.dialogList.age = "";
                    self.dialogList.sex = "";
                   return;
               }
                //获取出身日期
                self.dialogList.birthday = idNo.substring(6, 10) + "-" + idNo.substring(10, 12) + "-" + idNo.substring(12, 14);
                 //获取年龄
                let myDate = new Date();
                let month = myDate.getMonth() + 1;
                let day = myDate.getDate();
                let age = myDate.getFullYear() - idNo.substring(6, 10) - 1;
                if (idNo.substring(10, 12) < month || idNo.substring(10, 12) == month && idNo.substring(12, 14) <= day) {
                    age++;
                }
                self.dialogList.age = age;
                //获取性别
                 if (parseInt(idNo.substr(16, 1)) % 2 == 1) {
                    //男
                   self.dialogList.sex="男";
                } else {
                    //女
                   self.dialogList.sex = "女";
                }

            }
        }
    }
</script>

<style scoped>

    .selectW200{
        width: 200px;
    }

</style>
